import URLTitle from "../URLTitle"
import SimpleAxios from "../SimpleAxios"
import TokenAxios from "../TokenAxios"
import BaseUrl from "@/http/BaseUrl";


/** 封装文章所有的接口方法 */
const ArticlesAPI= {
    /**
     * 查询类别列表
     */
    getCategoriesList(params){
        let url = URLTitle.FRONT_CONTENT_CATEGORIES;
        return TokenAxios.get(url, params)
    },
    /**
     * 根据ID查询文章
     * @param {Object} params {id:1}
     */
    getArticleByID(params){
        let url =BaseUrl.FRONT_CONTENT+"/articles/"+params;
        return TokenAxios.get(url)
    },
    /**
     * 查询推荐的文章列表
     */
    getArticlesByRecommend(params){
        let url = URLTitle.FRONT_CONTENT_ARTICLES_RECOMMEND;
        return TokenAxios.get(url, params)
    },
    /**
     * 根据类别查询文章列表
     */
    getArticlesByCategory(params){
        let url = URLTitle.FRONT_CONTENT_ARTICLES_LIST_BY_CATEGORY
        return TokenAxios.get(url,params)
    },
    /**
     * 发表文章评论
     */
    AddContentComments(params){
        let url = URLTitle.FRONT_CONTENT_COMMENTS_ADD;
        return TokenAxios.post(url, params)
    },
    /**
     * 根据文章查询评论列表
     */
    getContentCommentsByArticles(params){
        let url = URLTitle.FRONT_CONTENT_COMMENTS_BY_ARTICLES;
        return TokenAxios.get(url, params)
    },
}

export default ArticlesAPI;
